package priv.yiyuan.example.design.player;

import priv.yiyuan.example.design.device.PlaybackDevice;

/**
 * 媒体播放器
 * <p>
 * 桥接模式(抽象部分) / 工厂方法模式(产品)
 */
public abstract class MediaPlayer {

    protected PlaybackDevice device;

    public MediaPlayer(PlaybackDevice device) {
        this.device = device;
    }

    public void setDevice(PlaybackDevice device) {
        this.device = device;
    }

    public abstract void playMedia(String content);

    public void stopMedia() {
        device.stop();
    }
}
